package com.example.behaviorpattern.state.impl;

import com.example.behaviorpattern.state.MusicPlayer;
import com.example.behaviorpattern.state.PlayerState;


 /**
  * 具体状态类：播放状态
  * @author yaojianfeng
  */
 public class PlayingState implements PlayerState {
    @Override
    public void play(MusicPlayer context) {
        System.out.println("音乐已经在播放了。");
    }

    @Override
    public void stop(MusicPlayer context) {
        System.out.println("停止音乐播放。");
        context.setState(new StoppedState());
    }

    @Override
    public void pause(MusicPlayer context) {
        System.out.println("暂停音乐播放。");
        context.setState(new PausedState());
    }
}